import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Boton para regresar al menu principal.
 * 
 * @author Asael Hernández García
 * @version (a version number or a date)
 */
public class Return extends Boton
{
    /**
     * Act - do whatever the Return wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    
    public void act() 
    {
       if(Greenfoot.mouseClicked(this)){
           getWorld().setBackground("Menu.png");        
           if(getWorld().getObjects(Credits.class).isEmpty())
               getWorld().addObject(new Credits(),193,522);
           if(getWorld().getObjects(Help.class).isEmpty())
               getWorld().addObject(new Help(), 118,522);
           if(getWorld().getObjects(Play.class).isEmpty())
               getWorld().addObject(new Play(), 41, 522);
           if(!getWorld().getObjects(Next.class).isEmpty())
                getWorld().removeObjects(getWorld().getObjects(Next.class));
           if(!getWorld().getObjects(ScoreBoard.class).isEmpty())
                getWorld().removeObjects(getWorld().getObjects(ScoreBoard.class));
           if(getWorld().getObjects(Records.class).isEmpty())
                 getWorld().addObject(new Records(),795,33);
           if(!getWorld().getObjects(Return.class).isEmpty())
                 getWorld().removeObjects(getWorld().getObjects(Return.class));
       }
    } 
}
      

